/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mahumLogs.backedbeans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
/**
 *
 * @author Edouard
 */
@Entity 
public class Etudiant extends Personne implements Serializable{
        
    @Column(unique = true)
    private String login;
    private String password;
    private String ipMask;
    
    @ManyToOne(cascade = {CascadeType.PERSIST})
    @JoinColumn(name="FK_PROMOTION")
    private Promotion promotion = new Promotion();
    
    @OneToMany(mappedBy = "etudiant",cascade = {CascadeType.PERSIST,CascadeType.REMOVE,CascadeType.REFRESH})
    private List<Machine> listeMachines = new ArrayList<>();

    /**
     * Constructeur
     */
    public Etudiant() {
        
    }

    /**
     * @return ipMask
     */
    public String getIpMask() {
        return ipMask;
    }

    /**
     * @param ipMask 
     */
    public void setIpMask(String ipMask) {
        this.ipMask = ipMask;
    }
    
    /**
     * @return login
     */
    public String getLogin() {
        return login;
    }

    /**
     * @param login 
     */
    public void setLogin(String login) {
        this.login = login;
    }

    /**
     * @return 
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password 
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * @return promotion
     */
    public Promotion getPromotion() {
        return promotion;
    }

    /**
     * @param promotion 
     */
    public void setPromotion(Promotion promotion) {
        this.promotion = promotion;
    }

    /**
     * @return listeMachines (List)
     */
    public List<Machine> getListeMachines() {
        return listeMachines;
    }

    /**
     * @param listeMachines 
     */
    public void setListeMachines(List<Machine> listeMachines) {
        this.listeMachines = listeMachines;
    } 
}
